﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="c"
uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib
prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
  <head>
    <link rel="stylesheet" href="${ctx}/common/common.css" />
    <title>流向信息</title>
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/style/admin.css" media="all" />
    <script src="${ctx}/common/plugins/layuiadmin/layui/layui.js"></script>

    <script src="${ctx}/common/plugins/publicJs/publicJs.js"></script>
    <script src="${ctx}/common/plugins/jquery-1.10.2.min.js"></script>
    <style></style>
  </head>
  <body>
    <!--主体内容层-->
    <div class="layui-body" style="left: 0px; margin: 0 20px">
      <!--主体内容层-->
      <div class="layui-fluid">
        <button type="button" id="rollback" class="layui-btn layui-btn-primary goback">返回</button>
        <!--列表-->
        <div class="layui-row layui-col-space15" style="margin-top: 30px">
          <fieldset class="layui-elem-field layui-field-title" style="margin: 0px">
            <legend class="layui-add-title">商品信息</legend>
          </fieldset>
          <div class="layui-col-md3 layui-col-space10" style="text-align: right">
            <img
              src="${ctx}${purMap.picture_img_t}"
              style="margin: 0px auto; width: 173px; height: 156px; border-radius: 10px; border: 1px solid #e7e7e7"
            />
          </div>
          <div class="layui-col-md7 layui-text" style="padding-left: 20px">
            <p>商品名称：${purMap.pName}</p>
            <p>产品编码：${purMap.standard_num}</p>
            <p>规格/单位：${purMap.specifications}/${purMap.unit}</p>
            <p>执行标准：${purMap.perf_standard}</p>
            <p>
              配料：
              <c:if test="${not empty purMap.mName and purMap.mName != '[null]'}">
                <c:out value="${purMap.mName}" />
              </c:if>
            </p>
            <c:set var="mStr" value="${purMap.shelf_life_m}" />
            <c:set var="dStr" value="${purMap.shelf_life_d}" />
            <c:set var="mNum" value="${empty mStr ? 0 : fn:replace(mStr, '个月', '')}" />
            <c:set var="dNum" value="${empty dStr ? 0 : fn:replace(dStr, '天', '')}" />
            <c:set var="totalDays" value="${mNum * 30 + dNum}" />
            <p>保质期：${totalDays}天</p>
          </div>
        </div>

        <!--表格-->
        <div class="layui-row layui-col-space15">
          <div class="layui-add-line"></div>
          <fieldset class="layui-elem-field layui-field-title" style="margin: 0px">
            <legend class="layui-add-title">生产信息</legend>
          </fieldset>
          <c:forEach items="${worksheetList}" var="wl">
            <div class="layui-col-md12">
              <table class="layui-table">
                <thead>
                  <tr>
                    <th>加工单编号</th>
                    <th>生产批次</th>
                    <th>产品名称</th>
                    <th>产品标准号</th>
                    <th>规格/单位</th>
                    <th>生产日期</th>
                    <th>生产车间</th>
                    <th>生产产线</th>
                    <th>创建日期</th>
                    <th>生产数量</th>
                    <th>入库数量</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>${wl.wCode}</td>
                    <td>${wl.bCode}</td>
                    <td>${wl.name}</td>
                    <td>${wl.standard_num}</td>
                    <td>${wl.specifications}/${wl.unit}</td>
                    <td>${wl.p_date}</td>
                    <td>${wl.workshopName}</td>
                    <td>${wl.proLineName}</td>
                    <td><fmt:formatDate pattern="yyyy-MM-dd" value="${wl.create_time}" /></td>
                    <td>${wl.actual_output}</td>
                    <td>
                      <c:set var="sum" value="0.00" />
                      <c:forEach items="${wl.instockList}" var="ilq">
                        <c:set var="sum" value="${ilq.quantity + sum}" />
                      </c:forEach>
                      <fmt:formatNumber value="${sum}" pattern="0.00" />
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
            <c:if test="${!empty wl.instockList && wl.instockList != '[null]'}">
              <c:forEach items="${wl.instockList}" var="il">
                <div class="layui-col-md12">
                  <span class="a1" style="float: left; cursor: pointer">▶</span>
                  <span class="a2" style="float: left; display: none; cursor: pointer">▼</span>
                  <p>
                    入库单号：${il.code}&nbsp;&nbsp;&nbsp;&nbsp;入库时间：
                    <fmt:formatDate pattern="yyyy-MM-dd" value="${il.create_time}" />
                    &nbsp;&nbsp;&nbsp;&nbsp;入库人：${il.creator_name}
                    入库仓库：${il.name}&nbsp;&nbsp;&nbsp;&nbsp;入库数量：${il.quantity}&nbsp;&nbsp;&nbsp;&nbsp;余量:
                    ${il.margin}
                  </p>
                </div>
                <c:if test="${!empty il.sellGoodsList && il.sellGoodsList != '[null]'}">
                  <c:forEach items="${il.sellGoodsList}" var="sgl">
                    <div class="layui-col-md12">
                      <p class="c1" style="margin-left: 30px; display: none">
                        销货单号：${sgl.code}&nbsp;&nbsp;&nbsp;&nbsp;客户：${sgl.cName}&nbsp;&nbsp;&nbsp;&nbsp;联系人：${sgl.contacts}&nbsp;&nbsp;&nbsp;&nbsp;联系电话：${sgl.phone}&nbsp;&nbsp;&nbsp;&nbsp;收货地址：${sgl.rec_address}&nbsp;&nbsp;&nbsp;&nbsp;订单日期
                        ：${sgl.order_date}&nbsp;&nbsp;&nbsp;&nbsp;订单数量：${sgl.quantity}
                      </p>
                    </div>
                  </c:forEach>
                </c:if>
              </c:forEach>
            </c:if>
          </c:forEach>
        </div>
      </div>
    </div>
  </body>
  <script>
    layui.use(["tree", "layer", "table"], function () {
      var $ = layui.$;
      var loading = layer.msg("数据加载中...");
      var table = layui.table;
      table.render({
        done: function () {
          layer.close(loading);
        },
      });
      var ins;
      //监听filter为demo的table中的工具条
      table.on("tool(demo)", function (obj) {
        var data = obj.data;
      });

      $(".demoTable .layui-btn").on("click", function () {
        var type = $(this).data("type");
        active[type] ? active[type].call(this) : "";
      });
      //给按钮绑定active中的方法
      $(".paramBtn .layui-btn").on("click", function () {
        var type = $(this).data("type");
        //查看是active这个json中是否有type这个方法，如果有调用，如果没有不知心；
        active[type] ? active[type].call() : "";
      });
    });
    document.getElementById("rollback").addEventListener("click", function () {
      window.history.back();
    });

    $(".a1").click(function () {
      $(".c1").show();
      $(".a1").hide();
      $(".a2").show();
    });

    $(".a2").click(function () {
      $(".c1").hide();
      $(".a2").hide();
      $(".a1").show();
    });
  </script>
</html>
